<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <div id="app">
        <my-parent-comp></my-parent-comp>
    </div>
    <template id="comp1">
        <h1>我的父组件
            <input type="text" v-model="mytitle">
            <my-child-comp v-bind:title="mytitle" name="名称"></my-child-comp>
        </h1>
    </template>
    <template id="comp2">
        <p>
            <input type="text" v-model="title">
            {{title}}我的子组件
        </p>
    </template>
</body>
</html>
<script>

        var vm = new Vue({
            el: "#app",
            components:{
                "my-parent-comp":{//声明父组件
                    data:function(){
                        return {mytitle:"你好"}

                    },
                    template:"#comp1",
                    components:{//声明子组件
                        "my-child-comp":{
                            props:["title"],
                            template:"#comp2"
                        }
                    }
                }
            }
        })    
    </script>